<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$app->get('/', function () use ($app) {
    return $app->version();
});

// 用户授权
$app->post('user/authorize', 'UserController@add');
// 每日记录图片上传
$app->post('task/daily/upload', 'TaskDailyController@upload');

$app->group(['middleware' => 'auth'], function () use($app) {
    //获取当前登录用户信息
    $app->get('user/authInfo','UserController@loginUser');
    // 任务列表
    $app->get('task/list', 'TaskController@taskList');
    // 添加任务
    $app->post('task/add', 'TaskController@add');
    // 任务信息
    $app->get('task/info', 'TaskController@taskInfo');
    // 任务监督者列表
    $app->get('task/supervisors', 'TaskController@supervisorsOfTask');
    // 用户监督的任务列表
    $app->get('task/watchedList', 'TaskController@taskListOfSupervisor');

    // 系统通知参与监督用户任务更新
    $app->get('notifyInfo','ParticipateController@notifyJoinerUpdate');
    // 参与者参与监督任务
    $app->post('joinTask','ParticipateController@joinTask');
    // 参与者点赞监督的某个任务
    $app->post('praiseTask','ParticipateController@praiseTask');

    // 每日记录列表
    $app->get('task/daily/list/{taskID}', 'TaskDailyController@taskDailyList');
    // 添加每日记录
    $app->post('task/daily/add/{taskID}', 'TaskDailyController@add');
    // 给每日记录点赞
    $app->put('task/daily/praise/{id}', 'TaskDailyController@praise');
});
